package com.ruoyi.consumer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumer.mapper.COrderInvoiceMapper;
import com.ruoyi.consumer.domain.COrderInvoice;
import com.ruoyi.consumer.service.ICOrderInvoiceService;

/**
 * 发票Service业务层处理
 * 
 * @author lizhouwei
 * @date 2023-11-17
 */
@Service
public class COrderInvoiceServiceImpl implements ICOrderInvoiceService 
{
    @Autowired
    private COrderInvoiceMapper cOrderInvoiceMapper;

    /**
     * 查询发票
     * 
     * @param invoiceId 发票主键
     * @return 发票
     */
    @Override
    public COrderInvoice selectCOrderInvoiceByInvoiceId(Integer invoiceId)
    {
        return cOrderInvoiceMapper.selectCOrderInvoiceByInvoiceId(invoiceId);
    }

    /**
     * 查询发票列表
     * 
     * @param cOrderInvoice 发票
     * @return 发票
     */
    @Override
    public List<COrderInvoice> selectCOrderInvoiceList(COrderInvoice cOrderInvoice)
    {
        return cOrderInvoiceMapper.selectCOrderInvoiceList(cOrderInvoice);
    }

    /**
     * 新增发票
     * 
     * @param cOrderInvoice 发票
     * @return 结果
     */
    @Override
    public int insertCOrderInvoice(COrderInvoice cOrderInvoice)
    {
        cOrderInvoice.setCreateTime(DateUtils.getNowDate());
        return cOrderInvoiceMapper.insertCOrderInvoice(cOrderInvoice);
    }

    /**
     * 修改发票
     * 
     * @param cOrderInvoice 发票
     * @return 结果
     */
    @Override
    public int updateCOrderInvoice(COrderInvoice cOrderInvoice)
    {
        cOrderInvoice.setUpdateTime(DateUtils.getNowDate());
        return cOrderInvoiceMapper.updateCOrderInvoice(cOrderInvoice);
    }

    /**
     * 批量删除发票
     * 
     * @param invoiceIds 需要删除的发票主键
     * @return 结果
     */
    @Override
    public int deleteCOrderInvoiceByInvoiceIds(Integer[] invoiceIds)
    {
        return cOrderInvoiceMapper.deleteCOrderInvoiceByInvoiceIds(invoiceIds);
    }

    /**
     * 删除发票信息
     * 
     * @param invoiceId 发票主键
     * @return 结果
     */
    @Override
    public int deleteCOrderInvoiceByInvoiceId(Integer invoiceId)
    {
        return cOrderInvoiceMapper.deleteCOrderInvoiceByInvoiceId(invoiceId);
    }
}
